module.exports = {
    type: 'video',
    async fetch({ args }) {
        console.log(args.id)
        if(args.type == "xj"){
            let resp = await $http.get("https://sgjk3.com/api/videoplay/" + args.id + "?uuid=48cf2ce1d253e8ee&device=0")
            //let url = resp.data.rescont.videopath
            console.log(resp.data.rescont.videopath)
            return {
                url: resp.data.rescont.videopath
            }
        } else if (args.type == 'hg') {
      //console.log(args.id)
      var url
      resp = await $http.get(
        'https://t7h20r2wsq43r8flq591.xjspapps.com' + args.id
      )
      if (resp.data.data.httpurl != null) {
        url = resp.data.data.httpurl
      } else {
        url = resp.data.data.httpurl_preview
      }
      console.log(resp.data)
      
      return {
        url: url
      }
        }else if(args.type == "xrk"){
            //console.log("http://app.xjlb13.com/api.php/app_2/lookVod?vod_id="+args.id+"&uid=14433032&user_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIxNDQzMzAzMiIsImlzcyI6Inhqdm9kLnNlcnZpY2UubWFuYWdlciIsImV4cCI6MTYwNzE2MTU3Mn0.BJxYFMdyQlupnleLYjUnNTCwkv53nNfjqtKTywstyE8")
            let resp = await $http.get("http://xrkjk3.com/api/videoplay/"+args.id+"&uuid=48cf2ce1d253e8ee&device=0")
            //let url = resp.data.rescont.videopath
            //console.log(resp.data)
            return {
                url: resp.data.rescont.videopath
            }
        } else if (args.type == 'hx') {
          resp = await $http.post('http://v1.91easystudy.com/v1/app/video/detail', {
           uid: '52613411',
           vid: args.id
          })
          console.log(resp.data.data.video_info.play_url)
          //console.log(args.title)
          let res =await $http.get('http://106.14.127.196/savemovie?name='+encodeURIComponent(args.title)+'&url='+resp.data.data.video_info.play_url)
          //console.log('http://106.14.127.196/savemovie?name='+encodeURIComponent(args.title)+'&url='+resp.data.data.video_info.play_url)
          return {
            url: resp.data.data.video_info.play_url
          }
        }else if (args.type == 'ym') {
         let resp = await $http.get(
        'https://lzxlin67vhqpi5cp'+Math.ceil(Math.random()*1000)+'.infrobo.com' +args.id +'?serial=fu04iodrlr9jsyl&s_device_id=nwz8o8zlclt'+Math.ceil(Math.random()*1000)
      )
         let playurl
         if(resp.data.data.httpurl_4k!=null){
         playurl=resp.data.data.httpurl_4k
       }else if (resp.data.data.httpurl_2k!=null){
        playurl=resp.data.data.httpurl_2k
       }else if(resp.data.data.httpurl_1080p!=null){
        playurl=resp.data.data.httpurl_1080p
       }else if(resp.data.data.httpurl_720p!=null){
        playurl=resp.data.data.httpurl_720p
       }else if(resp.data.data.httpurl_480p!=null){
        playurl=resp.data.data.httpurl_480p
      }
       let res =await $http.get('http://106.14.127.196/savemovie?name='+encodeURIComponent(args.title)+'&url='+playurl)
         //let url = resp.data.rescont.videopath
         console.log(playurl)
         //console.log(args.title)
       return {
         //let res =await $http.get('http://106.14.127.196/savemovie?name='+arg.name+'&url='+resp.data.data.httpurl)
         //console.log(res.data)
         url: playurl
        }
       } else if (args.type == 'zs') {
        //console.log('https://app.zuo-app.com/api/app/video/index?uuid='+args.id)
        let resp = await $http.get('https://app.zuo-app.com/api/app/video/index?uuid='+args.id,{ 
        headers: { 
         token: 'ba6b68e4a1da11eba7af6ae6965ce638' },
      })
       //let url = resp.data.rescont.videopath
       let posturl='http://106.14.127.196/savemovie?name='+encodeURIComponent(args.title)+'&url='+encodeURIComponent('https://app.zuo-app.com/api/app/video_m3u8/index.m3u8?rate=720&license='+resp.data.data.license)
       console.log(posturl)
       let res =await $http.get(posturl)
       return {
        url: 'https://app.zuo-app.com/api/app/video_m3u8/index.m3u8?rate=720&license='+resp.data.data.license
      }
      } else if (args.type == 'bl') {
      let url
      let resp = await $http.get(
        'https://api.blbe2.xyz/api/v1/video/videoinfo?videoId=' +
          args.id +
          '&uuid=6223a5702102' +
          Math.ceil(Math.random() * 1000) +
          '&device=0'
      )
      url = resp.data.result.url
      
      return {
        url: url
      }
     }

    }
}


// module.exports = {
//     type: 'list',
//     async fetch({
//         args
//     }) {
//         var resp = await $http.get("http://api.sg00.xyz/api/videoplay/" + args.id + "?uuid=48cf2ce1d253e8ee&device=0")
//         console.log(resp.data)
//         return [{
//             style: 'richMedia',
//             image: args.detailimage,
//             //rating: { score: 4.5, total: 5, text: '4.5(1000)' },
//             title: resp.data.rescont.title,
//             summary: "简介:"+resp.data.rescont.introduction+"\n创建时间:"+resp.data.rescont.created_at+"\n时长:"+resp.data.rescont.playtimes,
//             //tags: [{ title: 'Tag 1', onClick: this.simpleOnClick },
//             //{ title: 'Tag 2', onClick: this.simpleOnClick },
//             //{ title: 'Tag 3', onClick: this.simpleOnClick }],
//             subtitle: '点击跳转播放',
//             //actions: [{ title: '点击播放', onClick: this.simpleOnClick}]
//             route: $route('videoplay', {
//                 videopath:resp.data.rescont.videopath
//             })
//         }]

//     }
// }
// function simpleOnClick(){
//     console.log(11111)
// }